package com.welkom.everydate.services.implementations;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.welkom.everydate.dao.AuthorityDao;
import com.welkom.everydate.domain.Authority;
import com.welkom.everydate.services.interfaces.AuthorityService;
@Service
public  class AuthorityServiceImpl implements AuthorityService {
	@Resource
	AuthorityDao authorityDao;
	public List<Authority> getAllAuthoritys() {
		// TODO Auto-generated method stub
		return authorityDao.getAllAuthorities();
	}
	@Override
	public List<Authority> queryAuthoritiesByPage(Authority authority,
			int startIndex, int pageSize) {
		// TODO Auto-generated method stub
		return authorityDao.queryAuthoritiesByPage(startIndex, pageSize, authority);
	}
	@Override
	public int getAuthorityTotalCountByCondition(Authority authority) {
		// TODO Auto-generated method stub
		return authorityDao.getAuthoritiesCountByCondition(authority);
	}
	@Override
	public Authority getAuthorityById(long authorityId) {
		// TODO Auto-generated method stub
		return authorityDao.getAuthorityById(authorityId);
	}
	@Override
	public void saveChangesToAuthority(Authority authority) {
		// TODO Auto-generated method stub
		authorityDao.updateAuthority(authority);
	}
	@Override
	public void addAuthority(Authority authority){
		authorityDao.addAuthority(authority);
	}
	@Override
	public void removeAuthorityById(long authorityId){
		authorityDao.deleteAuthorityById(authorityId);
	}
	@Override
	public List<Authority> getAuthoritiesByRoleId(long roleId) {
		// TODO Auto-generated method stub
		return authorityDao.getAuthoritiesByRoleId(roleId);
	}
	@Override
	public void removeAuthoritiesByRoleId(long roleId) {
		// TODO Auto-generated method stub
		authorityDao.removeRoleAuthorityRelationsByRoleId(roleId);
	}
	@Override
	public void addAuthoritiesToRole(List<Authority> authorities, long roleId) {
		// TODO Auto-generated method stub
		authorityDao.addRoleAuthorityRelation(authorities, roleId);
	}
}
